/*
 * Problem: Expedition(POJ 2431)
 * Author: Yuanshun L
 * Created: 22-Nov-2021
 * Topic: Priority Queue
 */

#include<iostream>
#include<string>
#include<queue>
using namespace std;

const int maxn = 10000 + 5; //  maximum number of fuel stop
int fuel[maxn]; // the amount of fuel  available at the i-th stop
int dist[maxn]; // the distance from the current location to the i-th stop
int n,L,P; // the number of fuel stop

int solve(){
    int cnt = 0, pre=0, distance;
    priority_queue<int> pq;
    int tank = P; // the current surplus of fuel
    for(int i=n;i>=0;i--){
        distance = dist[i]-pre;
        pre = dist[i];

        if(tank < distance){
            while(!pq.empty()){
                tank += pq.top();
                pq.pop();
                cnt++;
                if(tank >= distance) break;
            }
            if(tank < distance) return -1;
        }
        pq.push(fuel[i]);
        tank -= distance;
    }
    return cnt;
}

int main(){

    freopen("data.in","r",stdin);
    freopen("data.out","w",stdout);

    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> dist[i] >> fuel[i];
    }
    cin >> L >> P;
    dist[0] = L; fuel[0] = 0;
    for(int i=1;i<=n;i++){
        dist[i] = L - dist[i];
    }

    cout << solve() << endl;


    return 0;

}